<template>
  <div class="counter-container">
    <div class="title">
      <p>对比图</p>
      <img src="../images/dataScreen-title.png" alt="" />
    </div>
    <div ref="chartContainer" class="chart-container"></div>
  </div>
</template>

<script setup lang="ts">
import * as echarts from 'echarts'
import { onMounted, ref } from 'vue'
let chartContainer = ref()
const option = {
  title: {},
  legend: {
    data: ['苹果', '华为'],
    left: 0,
    textStyle: {
      color: 'aqua',
    },
  },
  radar: {
    // shape: 'circle',
    indicator: [
      { name: '库存量', max: 6500 },
      { name: '销售数量', max: 16000 },
      { name: '毛利润', max: 30000 },
      { name: '市场所需估计量', max: 38000 },
      { name: '今日售卖量', max: 52000 },
      { name: '成本', max: 25000 },
    ],
  },
  grid: { bottom: 0, right: 0 },
  series: [
    {
      name: 'Budget vs spending',
      type: 'radar',
      data: [
        {
          value: [4200, 3000, 20000, 35000, 50000, 18000],
          name: '苹果',
        },
        {
          value: [5000, 14000, 28000, 26000, 42000, 21000],
          name: '华为',
        },
      ],
    },
  ],
}
onMounted(() => {
  let myChart = echarts.init(chartContainer.value)
  myChart.setOption(option)
})
</script>

<style lang="scss" scoped>
.counter-container {
  margin-top: 20px;
  width: 100%;
  height: 100%;
  background: url('../images/dataScreen-main-lt.png') no-repeat;
  background-size: 100% 100%;
  .title {
    padding-left: 10px;
    p {
      color: #fff;
    }
  }
  .chart-container {
    // margin-top: 20px;
    height: 220px;
    // background-color: aquamarine;
  }
}
</style>
